﻿<phone:PhoneApplicationPage xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                            xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
                            xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
                            xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
                            xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                            xmlns:views="clr-namespace:GroupChallengeWP7.Views"
                            xmlns:GroupChallengeWP7_ValueConverters="clr-namespace:GroupChallengeWP7.ValueConverters"
                            x:Class="GroupChallengeWP7.MainPage"
                            mc:Ignorable="d"
                            d:DesignWidth="480"
                            d:DesignHeight="696"
                            SupportedOrientations="Portrait"
                            Orientation="Portrait"
                            shell:SystemTray.IsVisible="True"
                            x:Name="ThisPage">
    <phone:PhoneApplicationPage.Resources>
        <GroupChallengeWP7_ValueConverters:OppositeValueConverter x:Key="OppositeValueConverter" />
    </phone:PhoneApplicationPage.Resources>
    <phone:PhoneApplicationPage.FontFamily>
        <StaticResource ResourceKey="PhoneFontFamilyNormal" />
    </phone:PhoneApplicationPage.FontFamily>
    <phone:PhoneApplicationPage.FontSize>
        <StaticResource ResourceKey="PhoneFontSizeNormal" />
    </phone:PhoneApplicationPage.FontSize>
    <phone:PhoneApplicationPage.Foreground>
        <StaticResource ResourceKey="PhoneForegroundBrush" />
    </phone:PhoneApplicationPage.Foreground>
    <!--Sample code showing usage of ApplicationBar-->
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True"
                              IsMenuEnabled="True">
            <shell:ApplicationBarIconButton IconUri="/Assets/appbar.add.rest.png"
                                            Text="join"
                                            Click="joinButton_Click" />
            <shell:ApplicationBarIconButton IconUri="/Assets/appbar.minus.rest.png"
                                            Text="leave"
                                            Click="leaveButton_Click" />
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>
    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot"
          Background="Transparent">
        <!--Pivot Control-->
        <controls:Pivot x:Name="PivotContainer"
                        SelectionChanged="PivotContainer_SelectionChanged">
            <controls:Pivot.Background>
                <LinearGradientBrush EndPoint="0.5,1"
                                     StartPoint="0.5,0">
                    <GradientStop Color="Black"
                                  Offset="0.366" />
                    <GradientStop Color="#FF0A78FF"
                                  Offset="0.114" />
                </LinearGradientBrush>
            </controls:Pivot.Background>
            <controls:Pivot.Title>
                <Grid>
                    <TextBlock HorizontalAlignment="Left"
                               Text="{Binding PlayerTitle}" />
                    <TextBlock HorizontalAlignment="Right"
                               Text="{Binding PlayerScoreTitle}"
                               Margin="0 0 10 0" />
                </Grid>
            </controls:Pivot.Title>
            <!--Pivot item one-->
            <controls:PivotItem Header="play">
                <views:QuestionView x:Name="questionView1"
                                    DataContext="{Binding CurrentQuestion}" />
            </controls:PivotItem>
            <!--Pivot item two-->
            <controls:PivotItem Header="stats"
                                x:Name="SecondPivotItem">
                <views:StatsView />
            </controls:PivotItem>
            <!--Pivot item three-->
            <controls:PivotItem Header="join">
                <views:JoinView x:Name="joinView1" />
            </controls:PivotItem>
        </controls:Pivot>
        <Grid Margin="0,0,196,-91"
              Height="91"
              VerticalAlignment="Bottom"
              Visibility="Collapsed">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Button x:Name="JoinButton"
                    Grid.Column="0"
                    Content="Join"
                    Height="77"
                    IsEnabled="{Binding InGame, Converter={StaticResource OppositeValueConverter}}"
                    IsEnabledChanged="JoinButton_IsEnabledChanged" />
            <Button x:Name="LeaveButton"
                    Grid.Column="1"
                    Content="Leave"
                    Width="130"
                    Height="77"
                    IsEnabled="{Binding InGame}"
                    IsEnabledChanged="LeaveButton_IsEnabledChanged" />
        </Grid>
    </Grid>
</phone:PhoneApplicationPage>